<extend name="./public/frame.html"/>
<block name="content">
	<blockquote class="layui-elem-quote search">
		<form action="" method="post" onsubmit="return validate_form(this)">
			<div class="layui-inline">
				<select name="province_id" id="province_id" class="layui-input" lay-filter="province" style="width: 120px;" onclick="getProvinceList();">
					<option value="">请选择省份</option>
					<?php foreach($provinceList as $key=>$value):?>
					<option value="<?php echo $value['region_id'];?>" <?php if($dateArray['province_id'] == $value['region_id']):?>selected<?php endif;?>><?php echo $value['region_name'];?></option>
					<?php endforeach;?>
				</select>
			</div>
			<div class="layui-inline">
				<select name="city_id" id="city_id" class="layui-input" lay-filter="city_id" style="width: 120px;">
					<option value="">请选择城市</option>
					<?php foreach($city_list as $key=>$value):?>
					<option value="<?php echo $value['region_id'];?>" <?php if($value['region_id'] == $dateArray['city_id']):?>selected<?php endif;?>><?php echo $value['region_name'];?></option>
					<?php endforeach;?>
				</select>
			</div>

			<div class="layui-inline">
				<select id="all_order" name="all_order" class="layui-input" style="width: 90px;">
					<option value="">全部数据</option>
					<option value="1" <?php if($dateArray['all_order'] == 1):?>selected<?php endif;?>>普通数据</option>
					<option value="2" <?php if($all_order['all_order'] == 2):?>selected<?php endif;?>>测试数据</option>
				</select>
			</div>
			<div class="layui-input-inline">
				<div class="layui-inline">
					<input type="text" class="layui-input date" id="start_time" name="start_time" value="<?php echo $dateArray['start_time'];?>" placeholder="开始日期" style="width: 150px;">
				</div>
				<div class="layui-inline">
					<input type="text" class="layui-input date" id="end_time" name="end_time" value="<?php echo $dateArray['end_time'];?>" placeholder="结束日期" style="width: 150px;">
				</div>
			</div>
			<div class="layui-inline">
				<input class="layui-btn" type="submit" value="搜索">（注：<span style="color: red;">时间跨度越大,查询所需时间越长,请耐心等待！</span> 建议：<span style="color: green;">时间跨度越小越好</span>）
			</div>
		</form>
	</blockquote>
	<table class="layui-table" style="width: 40%;float: left;">
		<h2 class="layui-colla-title">

			<?php if(empty($dateArray['start_time']) && empty($dateArray['end_time'])):?>
			<span class="date" style="color: green"><?php echo date("Y/m/d");?></span>
			<?php else:?>
			<span class="date" style="color: green"><?php echo date("Y/m/d",strtotime($dateArray['start_time']));?></span>&nbsp;&nbsp;
			/&nbsp;&nbsp;
			<span class="date" style="color: green"><?php echo date("Y/m/d",strtotime($dateArray['end_time']));?></span>
			<?php endif;?>
			数据总览
			<!--（注释：<span style="color: red">活跃 - 连续在线N天/且完成2*N单</span>  /  <span style="color: red">僵尸 - 连续N天未上线/且未完成N单</span>）-->
		</h2>
		<tr>
			<td colspan="4" style="color: green">司机数据（总人数：<?php echo $driverInfo['onlineNumber']+$driverInfo['offlineNumber'];?>）</td>
		</tr>
		<tr>
			<td style="text-align: center;width: 25%;height: 25px;">司机在线人数</td>
			<td style="width: 25%"><?php echo $driverInfo['onlineNumber'];?></td>
			<td style="text-align: center;width: 25%;">司机下线人数</td>
			<td style="width: 25%"><?php echo $driverInfo['offlineNumber'];?></td>
		</tr>
		<tr>
			<td style="text-align: center;width: 25%;height: 25px;">平均接单时间（秒）</td>
			<td style="width: 25%"><?php echo $orderInfo['average_second'];?></td>
			<td style="text-align: center;width: 25%;height: 25px;">司机收入(元)</td>
			<td style="width: 25%"><?php echo $walletInfo['average_money'];?></td>
		</tr>
		<tr>
			<td style="text-align: center;width: 25%;height: 25px;">提现金额（元）</td>
			<td style="width: 25%"><?php echo $orderInfo['allTimeMoney'];?></td>
			<td style="text-align: center;width: 25%;height: 25px;">合规司机人数</td>
			<td style="width: 25%"><?php echo $driverInfo['compliance'];?></td>
		</tr>
		<tr>
			<td colspan="4" style="color: green">订单数据（总数据：<?php echo $orderInfo['allOrderCount'];?>）</td>
		</tr>
		<tr>
			<td style="text-align: center;;height: 25px;">时时订单</td>
			<td><?php echo $orderInfo['allTimeCount'];?></td>
			<td style="text-align: center;">预约订单</td>
			<td><?php echo $orderInfo['allMakeCount'];?></td>
		</tr>
		<tr>
			<td style="text-align: center;height: 25px;">等待接单</td>
			<td><?php echo $orderInfo['allWaitCount'];?></td>
			<td style="text-align: center;">取消订单</td>
			<td><?php echo $orderInfo['allCancelCount'];?></td>
		</tr>
		<tr>
			<td style="text-align: center;height: 25px;">预约抢单</td>
			<td><?php echo $orderInfo['allMakeOrderCount'];?></td>
			<td style="text-align: center;">行程中订单</td>
			<td><?php echo $orderInfo['allTakeCount'];?></td>
		</tr>
		<tr>
			<td style="text-align: center;height: 25px;">待结算订单</td>
			<td><?php echo $orderInfo['allWaitSettleCount'];?></td>
			<td style="text-align: center;">已结算订单</td>
			<td><?php echo $orderInfo['allFinishCount'];?></td>
		</tr>
		<tr>
			<td style="text-align: center;height: 25px;">正常订单</td>
			<td><?php echo $orderInfo['allNormalCount'];?></td>
			<td style="text-align: center;">异常订单</td>
			<td><?php echo $orderInfo['allAbnormalCount'];?></td>
		</tr>
		<tr>
			<td style="text-align: center;height: 25px;">正常订单比例（%）</td>
			<td><?php echo $orderInfo['allNormalRatio'];?>%</td>
			<td style="text-align: center;">异常订单比例（%）</td>
			<td><?php echo $orderInfo['allAbnormalRatio'];?>%</td>
		</tr>
		<tr>
			<td colspan="4" style="color: green">流水数据（总流水：<?php echo $walletInfo['sumRealFee'];?>）</td>
		</tr>
		<tr>
			<td style="text-align: center;height: 25px;">已结算金额</td>
			<td><?php echo $walletInfo['settleRealFee'];?></td>
			<td style="text-align: center;">未结算金额</td>
			<td><?php echo $walletInfo['waitRealFee'];?></td>
		</tr>
		<tr>
			<td style="text-align: center;height: 25px;">实际支付金额</td>
			<td><?php echo $walletInfo['need_price'];?></td>
			<td style="text-align: center;">平台优惠金额</td>
			<td><?php echo $walletInfo['coupon_price'];?></td>
		</tr>
		<tr>
			<td style="text-align: center;height: 25px;">平台费</td>
			<td><?php echo $walletInfo['platform_price'];?></td>
			<td style="text-align: center;">余额支付</td>
			<td><?php echo $walletInfo['balanceMoney'];?></td>
		</tr>
		<tr>
			<td style="text-align: center;height: 25px;">支付宝支付</td>
			<td><?php echo $walletInfo['alipayMoney'];?></td>
			<td style="text-align: center;">微信支付</td>
			<td><?php echo $walletInfo['wechatMoney'];?></td>
		</tr>
	</table>
	<table class="layui-table" style="width: 59%;float: right">
		<tr>
			<td>
				<div id="container" style="width: auto; height: 410px; margin: 0 auto"></div>
			</td>
		</tr>
	</table>
	<script src="https://cdn.highcharts.com.cn/highcharts/highcharts.js"></script>
	<script>
		layui.use(['table','laydate' ],function () {
			var table = layui.table, laydate = layui.laydate;
			//下单时间检索
			lay('.date').each(function(){
				laydate.render({
					elem: this
					,type: 'date'
					,trigger: 'click'
				});
			});
		});
		function validate_form() {
			if($('#start_time').val() == '' || $('#end_time').val() == ''){
				layer.msg('搜索时间不能为空');return false;
			}
		}
		var chart = Highcharts.chart('container',{
			chart: {
				type: 'column'
			},
			title: {
				text: '快车-订单数据'
			},
			xAxis: {
				categories: [
					'00:00','01:00','02:00','03:00','04:00','05:00','06:00','07:00','08:00','09:00','10:00','11:00',
					'12:00','13:00','14:00','15:00','16:00','17:00','18:00','19:00','20:00','21:00','22:00','23:00'
				],
				crosshair: true
			},
			yAxis: {
				min: 0,
				title: {
					text: '订单数量'
				}
			},
			tooltip: {
				// head + 每个 point + footer 拼接成完整的 table
				headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
				pointFormat: '<tr><td style="color:{series.color};padding:0"> </td>' +
						'<td style="padding:0"><b>{point.y}</b></td></tr>',
				footerFormat: '</table>',
				shared: true,
				useHTML: true
			},
			plotOptions: {
				column: {
					borderWidth: 0,
					dataLabels: {
						enabled: true,
						inside: true //设置显示对应y的值
					}
				}
			},
			series: [{
				name: '今天24小时订单数量',
				data: [<?php echo $sumOrderNumStr;?>]
			}]
		});

	</script>
	<script>
		//选择省市切换
		function getProvinceList(){
			$("#city_id").empty();
			$("#city_id").append('<option value=>请选择城市</option>');
			var province_id = $("#province_id").val();
			$.ajax({
				url:'{:url("/admin/Franchisee/cityList")}',
				async:true,
				//dataType:'json',
				type:'post',
				data:{'province_id':province_id},
				success:function(res){
					$("#city_id").append(res);
				},
				error:function(e){
					layer.msg('请求错误');return false;
				}
			})
		};
	</script>
</block>

